/**
 * 建模类
 */
import BaseType from './BaseType.js';
import TypeKind from '../enums/TypeKind.js';

export default class ModelingClass extends BaseType {

    caption = '';
    /**
     * 是否已改动，用于提醒用户保存
     * @type {boolean}
     */
    modified = false;
    /**
     * @type {Date}
     */
    saveTime = null;

    constructor(type, packageName, simpleName) {
        type = TypeKind.validate(type, 'modeling');
        super(type, packageName, simpleName);
    }

    static of(object) {
        if (typeof object !== 'object') {
            return undefined;
        }
        let clazz = new ModelingClass(object.kind, object.packageName, object.simpleName);
        clazz.update(object);
        return clazz;
    }

    clone() {
        return ModelingClass.of(this);
    }

}
